package com.shengqiang.zhenhuiTransfer.config;

import com.google.common.collect.Maps;
import com.shengqiang.zhenhuiTransfer.entity.SystemConfig;
import com.shengqiang.zhenhuiTransfer.mapper.SystemConfigMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Map;

/**
 * Created by Administrator on 2018/5/16.
 */
@Component
public class SysConfigs {

    private static final Logger logger= LoggerFactory.getLogger(SysConfigs.class);

    public static Map<String,SystemConfig> configs= Maps.newHashMap();

    @Autowired
    private SystemConfigMapper configMapper;

    @PostConstruct
    public void init(){
        logger.info("----- configs is begin loading------");
        logger.info(configMapper.selectConfigs().toString());
        configs=configMapper.selectConfigs();
        logger.info("----- configs has been loaded------");
    }
}
